﻿@import '../abstracts/variables';

.mud-tabs {
    display: flex;
    flex-direction: column;

    &.mud-tabs-reverse {
        flex-direction: column-reverse;
    }

    &.mud-tabs-vertical {
        flex-direction: row;
    }

    &.mud-tabs-vertical-reverse {
        flex-direction: row-reverse;
    }

    &.mud-tabs-rounded {
        border-radius: var(--mud-default-borderradius);

        .mud-tabs-toolbar {
            border-radius: var(--mud-default-borderradius);
        }

        .mud-tabs-panels {
            border-radius: var(--mud-default-borderradius);
        }
    }
}

.mud-tabs-toolbar {
    z-index: 20;
    position: relative;
    background-color: var(--mud-palette-surface);

    &.mud-tabs-border-left {
        border-top-right-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        border-right: 1px solid var(--mud-palette-lines-default);
    }

    &.mud-tabs-border-right {
        border-top-left-radius: 0 !important;
        border-bottom-left-radius: 0 !important;
        border-left: 1px solid var(--mud-palette-lines-default);
    }

    &.mud-tabs-border-top {
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        border-bottom: 1px solid var(--mud-palette-lines-default);
    }

    &.mud-tabs-border-bottom {
        border-top-left-radius: 0 !important;
        border-top-right-radius: 0 !important;
        border-top: 1px solid var(--mud-palette-lines-default);
    }

    &.mud-tabs-rounded {
        border-radius: var(--mud-default-borderradius);
    }

    &.mud-tabs-vertical {
        .mud-tabs-toolbar-inner {
            flex-direction: column;

            .mud-tabs-scroll-button {
                .mud-button-root {
                    width: 100%;
                    border-radius: 0px;
                    height: 32px;

                    .mud-icon-button-label {
                        .mud-icon-root{
                            transform:rotate(90deg);
                        }
                    }
                }
            }
        }
    }

    & .mud-tabs-toolbar-inner {
        display: flex;
        min-height: 48px;
    }
}


.mud-tabs-toolbar-content {
    width: 100%;
    flex: 1 1 auto;
    display: inline-block;
    position: relative;
    white-space: nowrap;
    overflow: hidden;

    & .mud-tabs-toolbar-wrapper {
        width: max-content;
        position: inherit;
        display: flex;
        transition: .3s cubic-bezier(.25,.8,.5,1);

        &.mud-tabs-centered {
            margin: auto;
        }

        &.mud-tabs-vertical {
            flex-direction: column;
        }
    }
}

.mud-tabs-panels {
    position: relative;
    transition: .3s cubic-bezier(.25,.8,.5,1);

    &.mud-tabs-vertical {
        display: flex;
        flex-grow: 1;
    }
}

.mud-tab {
    width:100%;
    min-width: 160px;
    max-width: 360px;
    display: inline-flex;
    padding: 6px 12px;
    min-height: 48px;
    flex-shrink: 0;
    font-weight: 500;
    line-height: 1.75;
    user-select: none;
    white-space: normal;
    letter-spacing: 0.02857em;
    text-transform: uppercase;
    text-align: center;
    align-items: center;
    justify-content: center;
    transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;

    &:hover {
        cursor: pointer;
        background-color: var(--mud-palette-action-default-hover);
    }

    &.mud-tab-active {
        color: var(--mud-palette-primary);

        &:hover {
            background-color: var(--mud-palette-primary-hover);
        }
    }

    &.mud-disabled {
        cursor: default;
        pointer-events: none;
        color: var(--mud-palette-text-disabled);
    }

    & .mud-tab-icon-text {
        margin-right: 8px;
    }
}

.mud-tab-slider {
    position: absolute;
    background: var(--mud-palette-primary);

    &.mud-tab-slider-horizontal {
        height: 2px;
        left: 0;
        bottom: 0;
        transition: left .3s cubic-bezier(.64,.09,.08,1);
        will-change: left;

        &.mud-tab-slider-horizontal-reverse {
            top: 0px;
        }
    }

    &.mud-tab-slider-vertical {
        width: 2px;
        right: 0;
        transition: top .3s cubic-bezier(.64,.09,.08,1);
        will-change: top;

        &.mud-tab-slider-vertical-reverse {
            left: 0;
        }
    }
}

.mud-tab-badge{
    margin-left:8px;
}

@each $color in $mud-palette-colors {
    .mud-tabs-toolbar-#{$color} {
        background-color: var(--mud-palette-#{$color});
        color: var(--mud-palette-#{$color}-text);

        .mud-tab-slider {
            background: var(--mud-palette-#{$color}-text);
        }

        .mud-tab {
            &.mud-tab-active {
                color: var(--mud-palette-#{$color}-text);

                &:hover {
                    background-color: var(--mud-palette-#{$color}-lighten);
                }
            }
        }
    }
}


.tab-transition {
    &-enter {
        transform: translate(100%, 0);
    }

    &-leave, &-leave-active {
        position: absolute;
        top: 0;
    }

    &-leave-to {
        position: absolute;
        transform: translate(-100%, 0);
    }
}

.tab-reverse-transition {
    &-enter {
        transform: translate(-100%, 0);
    }

    &-leave, &-leave-to {
        top: 0;
        position: absolute;
        transform: translate(100%, 0);
    }
}